import { ref, computed } from 'vue'
import { defineStore } from 'pinia'

export const useCounterStore = defineStore('counter', () => {
  const count = ref(0)
  const name = ref("张大帅")
  const token = ref("")
  const id = ref("")
  const uType = ref("")
  const username = ref("")
  const password = ref("")
  const doubleCount = computed(() => count.value * 2)

  function increment() {
    count.value++
  }

  function setToken(newToken) {
    token.value = newToken
  }



  return { id,count, name,uType, doubleCount, token, username, password, increment, setToken }

},
  {
    persist: true,
  }
)
